from rest_framework.serializers import ModelSerializer

from user.models import UserModel, SfUser, NewsType, Essay, Video, Topic, Dynamic


class UserSer(ModelSerializer):
    class Meta:
        model = UserModel
        fields = "__all__"


class SfUserSer(ModelSerializer):
    class Meta:
        model = SfUser
        fields = "__all__"


class NewsTypeSer(ModelSerializer):
    class Meta:
        model = NewsType
        fields = "__all__"


class EssaySer(ModelSerializer):
    user = UserSer(read_only=True)
    type = NewsTypeSer(read_only=True)

    class Meta:
        model = Essay
        fields = "__all__"


class VideoSer(ModelSerializer):
    user = UserSer(read_only=True)
    type = NewsTypeSer(read_only=True)

    class Meta:
        model = Video
        fields = "__all__"


class TopicSer(ModelSerializer):
    class Meta:
        model = Topic
        fields = "__all__"


class DynamicSer(ModelSerializer):
    type = NewsTypeSer(read_only=True)
    topic = TopicSer(read_only=True)
    user = UserSer(read_only=True)

    class Meta:
        model = Dynamic
        fields = "__all__"
